<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>

<@head>
<link rel="stylesheet" href="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.css"/>
<link rel="stylesheet" href="/misc/app/jq-liandong/area.css"/>
<style type="text/css">
    .ci{float: left;padding:7px 0 0 5px}
    .over_box{padding-top: 5px;overflow: hidden;zoom: 1;}
    .over_radio{float: left;margin:10px 5px 0 5px !important;}
    .over_text{width:90px;float: left;}
</style>
</@head>

<@body>
<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/moment.min.js"></script>
<script src="/misc/adminlte-2.3.7/plugins/daterangepicker/daterangepicker.js"></script>
<script src="/misc/app/js/salesman_payrule_new.js"></script>
<script src="/misc/app/jq-liandong/cityJson.js"></script>
<script src="/misc/app/jq-liandong/citySet.js"></script>
<script src="/misc/app/jq-liandong/Popt.js"></script>
<script>var PicDomain = "${PicDomain!}"</script>
</@body>

<@layout_default>

<div class="box" name="md_add_activity">
    <div class="box-header">
        <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
        </button>-->
        <h4 class="modal-title"><i class="fa fa-plus"></i> 创建规则</h4>
    </div>
    <div class="box-body">
        <form class="form-horizontal" name="form_new_payrule">
            <input type="hidden" name="id" id="hidden_id" value="">
            <div class="form-group">
                <label class="col-sm-2 control-label" name="namelabel"><strong class="text-red bold">*</strong> 规则名称</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" style="width:300px;" placeholder="规则名称" name="name" maxlength="200" />
                </div>
            </div>
            <div class="form-group area_div" id="regionDiv">
                <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 适用区域</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control area"  style="width:300px;float:left;"   name="所在区域" readonly="readonly"/>
                    <span class="ci">
                        <button type="button" class="btn-default" name="btn_add_area" id="btn_add_area">
                            <i class="fa fa-plus"></i>添加
                        </button>
                    </span>
                </div>
            </div>

            <div class="hide form-group " id="add_area_div">
                <label class="col-sm-2 control-label"></label>
               <div class="col-sm-5" >
                    <input type="text" class="form-control area"  style="width:300px;float:left;"   name="所在区域" readonly="readonly"/>
                    <span class="ci">
                        <button type="button" class="btn-default btn_delete_area" name="btn_delete_area" >
                            <i class="fa fa-plus"></i>删除
                        </button>
                    </span>
                </div>
            </div>



            <div class="form-group">
                <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong>有效时间</label>
                <div class="col-sm-1" style="width:170px;">
                    <input type="text" id="valid_begin_time" class="" size="20">
                </div>
                <div class="col-sm-1" style="width:10px;text-align:center;padding-top:5px;">
                    至
                </div>
                <div class="col-sm-2">
                    <input type="text" id="valid_end_time" class="" size="20">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong>支付方式</label>
                <div class="col-sm-5" style="padding-top:7px;">
                    <input type="radio" name="payway" id="radio_yes" value="1" runat="server" checked />手动提现&nbsp;&nbsp;&nbsp;&nbsp;
                    <#--<input type="radio" name="payway" id="radio_no" value="2" runat="server"  />自动支付-->
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" name="namelabel"><strong class="text-red bold">*</strong> 每日提现次数</label>
                <div class="col-sm-5">
                    <input type="text" class="form-control" style="width:300px;float:left" name="day_limit" value="" maxlength="10" />
                    <span class="ci">次</span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 提现条件</label>
                <div class="col-sm-10 over_box">
                    <div class="left">
                        <input type="radio" name="pay_condition" value="1" runat="server" class="over_radio" checked/><span style="float: left;padding:7px 5px 0 0">按瓶数</span>
                        <input type="text" class="form-control over_text" id="by_bing" value="" maxlength="10" />
                    </div>
                    <div class="left">
                        <input type="radio" name="pay_condition"  value="2" runat="server" class="over_radio"  /><span style="float: left;padding:7px 5px 0 0">按金额</span>
                        <input type="text" class="form-control over_text"  id="by_price" value="" maxlength="10" />
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 产品</label>
                <div class="col-sm-10">
                    <button type="button" class="btn btn-default" name="btn_select_product" data-toggle="modal"
                            data-target="#selectedProduct_modals"><i class="fa fa-plus"></i> 选择商品
                    </button>
                </div>
            </div>

            <div class="form-group" id="selectedProDiv">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-10">
                    <table class="table table-striped table-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>产品名称</th>
                            <th>产品编号</th>
                            <th>每瓶费用</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="product_table">
                            <#--<#if selectedProductList?exists>-->
                                <#--<#list selectedProductList as item1>-->
                                <#--<tr>-->
                                    <#--<td>${item1.id}</td>-->
                                    <#--<td>${item1.name}</td>-->
                                    <#--<td>${item1.number}</td>-->
                                    <#--<td>${item1.price!}</td>-->
                                    <#--<td>-->
                                        <#--<button type="button" class="btn btn-default btn-xs" name="btn_delete_activity_product"-->
                                                <#--data-activity-product-id="${item1.id}">删除-->
                                        <#--</button>-->
                                    <#--</td>-->
                                <#--</tr>-->
                                <#--</#list>-->
                            <#--</#if>-->
                        </tbody>
                    </table>
                </div>
            </div>
        </form>

    </div>
    <div class="box-footer text-center">
        <button type="button" class="btn btn-default" name="btn_cancel" id="btn_cancel">取消</button>
        <button type="button" class="btn btn-primary" name="btn_save" id="btn_save">保存</button>
    </div>
</div>


<!--===========Modals  点击“选择商品”按钮，显示商品列表   start================--->
<div class="modal" id="selectedProduct_modals" tabindex="-1">
    <div class="modal-dialog" role="document" style="width:700px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h5 class="modal-title"><i class="fa fa-plus"></i> 选择商品</h5>
            </div>
            <span class="pull-right text-muted" style="margin: 14px 10px 0 0;">共<span id="proTotal"> ${productList.resultTotal}</span> 条记录</span>
            <form class="form-inline" action="">
                <div class="input-group">
                    <div class="input-group-addon">关键字</div>
                    <input type="text" class="form-control" style="width: 260px" name="keyword" id="keyword" value="${keyword!}"
                           placeholder="名称、编号、品牌"/>
                </div>

                <button type="button" class="btn btn-warning" name="pro_query"><i class="fa fa-search"></i> 查询</button>
            </form>
            <div class="modal-body">
                <table class="table table-striped table-hover">
                    <thead>
                    <tr>
                        <th></th>
                        <th>ID</th>
                        <th>产品名称</th>
                        <th>产品编号</th>
                        <th>每瓶费用</th>
                    </tr>
                    </thead>
                    <tbody id="product_model">
                        <#list productList.result as item>
                        <tr>
                            <td>
                                <input type="checkbox" name="product" value="${item.id!}" id="product_${item.id!}"/>
                            </td>
                            <td>${item.id}</td>
                            <td class="name_${item.id!}">${item.name}</td>
                            <td class="number_${item.id!}">${item.number}</td>
                            <td><input type="text" class="price" id="price_${item.id!}"  data-id="${item.id!}"  size="5"/></td>
                        </tr>
                        </#list>
                    </tbody>
                </table>
            </div>
            <div class="box-footer text-center" id="page_model" data-total="${productList.pageTotal}"
                 data-size="${productList.pageSize}">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" id="selectPro_cancel">取消</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal" id="selectPro_confirm">确认</button>
            </div>
        </div>
    </div>
</div>
<!--===========点击“选择商品”按钮，显示商品列表   end================--->

<div class="modal" id="preview_dialog" tabindex="-1">
    <div style="position:absolute; left:50%; top:50%; margin-left:-187.5px; margin-top:-333.5px;">
        <iframe width="375" height="667"></iframe>
        <span class="close" data-dismiss="modal"
              style="background-color: #FFF; width: 20px; height: 20px; text-align: center; line-height: 20px; opacity: 1;">&times;</span>
    </div>

</div>


</@layout_default>